<?php
// +----------------------------------------------------------------------
// | 海豚PHP框架 [ DolphinPHP ]
// +----------------------------------------------------------------------
// | 版权所有 2016~2017 河源市卓锐科技有限公司 [ http://www.zrthink.com ]
// +----------------------------------------------------------------------
// | 官方网站: http://dolphinphp.com
// +----------------------------------------------------------------------
// | 开源协议 ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------

namespace app\user\validate;

use think\Validate;

/**
 * 验证器
 * @package app\admin\validate
 * @author 陈梦晨 <2391157750@qq.com>
 */
class AccessManage extends Validate
{
    //定义验证规则
    protected $rule = [
        'provinceid|省份' => 'require|unique:admin_access_area,provinceid^userid',
        'memberid|客户' => 'require|unique:admin_access_member,memberid^userid',
        'storeid|货主' => 'require|unique:admin_access_store,storeid^userid',
        'warehouseid|仓库' => 'require|unique:admin_access_warehouse,warehouseid^userid',
    ];

    //定义验证提示
    protected $message = [
        'provinceid.require' => '请选择业务区域',
        'provinceid.unique' => '业务区域已经存在',
        'memberid.require' => '请输入业务客户相关信息',
        'memberid.unique' => '业务客户已经存在',
        'storeid.require' => '请选择业务货主',
        'storeid.unique' => '业务货主已经存在',
        'warehouseid.require' => '请选择业务仓库',
        'warehouseid.unique' => '业务仓库已经存在',
    ];
    protected $scene = [
        'area'  =>  ['provinceid'],
        'member'  =>  ['memberid'],
        'store'  =>  ['storeid'],
        'warehouse'  =>  ['warehouseid'],
    ];
}
